import $V from './$V';
import ma from './ma';

export default function wvad(open, high, low, close, volume, length) {
    let wvadValue = $V.init(open.length,0);
    let vadValue = $V.mul($V.div($V.sub(close,open),$V.sub(high,low)),volume);
    vadValue = $V.set_by_index(vadValue, $V.where(vadValue, '==', 'NaN'), 0);

    wvadValue = $V.div_constant($V.mul_constant(ma(vadValue,length),length),1000);
    return wvadValue;
}
